﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;

using Redboil.Bfp.Core;
using System.Web.Routing;
using System.ServiceModel.Activation;
using Redboil.Bfp.Web.Services;

namespace Redboil.Practices.Wcf {
    public class Global : System.Web.HttpApplication {
        private Container container;

        protected void Application_Start(object sender, EventArgs e) {
            RouteTable.Routes.Add(new ServiceRoute("SampleService", new WebServiceHostFactory(), typeof(SampleService)));
            container = Container.Instance;

            //log4net.Config.XmlConfigurator.Configure();
        }

        protected void Session_Start(object sender, EventArgs e) {
            //Cache["Organization"] = container.Resolve<ICacheService>().
        }

        protected void Application_BeginRequest(object sender, EventArgs e) {

        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e) {

        }

        protected void Application_Error(object sender, EventArgs e) {
            //Server.Transfer("~/Error.aspx");
        }

        protected void Session_End(object sender, EventArgs e) {

        }

        protected void Application_End(object sender, EventArgs e) {
            container.Dispose();
        }
    }
}